package com.gitee.wsl.struct.either.ext

import arrow.core.Either


fun <L, R> Either<L, R>.rightOrElse(elseValue: R): R = when (this) {
    is Either.Left -> elseValue
    is Either.Right -> this.value
}

fun <L, R> Either<L, R>.leftOrElse(elseValue: L): L = when (this) {
    is Either.Left -> this.value
    is Either.Right -> elseValue
}